package com.app.base.app;


import com.app.BuildConfig;
import com.caszx.chargingpile.R;
import com.nispok.snackbar.Snackbar;
import com.nispok.snackbar.SnackbarManager;
import com.rey.material.app.Dialog;
import com.rey.material.app.DialogFragment;
import com.rey.material.app.SimpleDialog;
import com.umeng.analytics.MobclickAgent;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.ViewGroup;
import android.widget.Toast;

public abstract class BaseActivity extends AppCompatActivity{
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		init();
	}
	
	/**
	 * 初始化<b>（不包含View的初始化） 
	 */
	protected abstract void init();
	
	
	@Override
	protected void onResume() {
		super.onResume();
		if(!BuildConfig.DUBUG)
		MobclickAgent.onResume(this);
	}

	@Override
	protected void onPause() {
		super.onPause();
		if(!BuildConfig.DUBUG)
		MobclickAgent.onPause(this);
	}
	

	public void startActivity(Intent intent,boolean transition) {
		super.startActivity(intent);
		if(transition)
//		overridePendingTransition(R.anim.activity_slide_in_right,R.anim.activity_slide_no);
		overridePendingTransition(R.anim.activity_push_up_in,R.anim.activity_push_up_out);
	}
	
	@Override
	public void startActivity(Intent intent) {
		startActivity(intent,true);
	}

	@Override
	public void startActivityForResult(Intent intent, int requestCode) {
		super.startActivityForResult(intent, requestCode);
		overridePendingTransition(R.anim.activity_push_up_in,R.anim.activity_push_up_out);
	}


	@Override
	public void finish() {
		super.finish();
		if(!"MainActivity".equals(getClass().getSimpleName())){
//			overridePendingTransition(R.anim.activity_slide_no,
//					R.anim.activity_slide_out_right);
			overridePendingTransition(R.anim.activity_push_out_in,R.anim.activity_push_out_out);
		}
	}

}
